<template>
    <view>

        <u-input  
        type="select" 
        :select-open="pickerShow" 
        v-model="selectvalue" 
        :placeholder="selectObj.placeholder?selectObj.placeholder:'请选择'" 
        
        @click="selectHandle"
        v-if="!formObj.value"
        ></u-input>
        <text v-else>
            {{formObj.value}}
        </text>


        <u-select v-model="pickerShow" :list="list" @confirm="confirm"></u-select>
		
    </view>
</template>


<script>
export default {


    props: {
        formObj: {
            type: Object,
            
        }
    },

    data () {
        return {

            selectObj: {},
            list: [],
            pickerShow:false,
            selectvalue:'',
           

        }
    },

    
    mounted() {
        
     this.selectObj = this.formObj
     


    var item = this.selectObj.items

    
    item.map(item=>this.list.push({
        value: item.label_value,
        label: item.label_name,
        
    }))

    },

    methods: {

        selectHandle() {
            this.pickerShow = true
        },


        confirm(e) {
               
            this.selectvalue = e[0].label
                
            var obj = {
                key: this.selectObj.name,
                value: e[0].label
            }
            this.$emit('childFn',obj)
			}
    }




    
}
</script>

<style lang="less" scoped>

</style>